home *** CD-ROM | disk | FTP | other *** search
/ The Business Master (3rd Edition) / The Business Master (3rd Edition).iso / files / datature / pdevbas1 / utilprog.exe / DBIMPORT.SRC < prev    next >
Encoding:
Text File  |  1990-06-01  |  2.8 KB  |  37 lines

  1. |2010 DIM YT%(|35,8)
  2. *23 |2020 DIM YH%(|02,|04),YE%(|02,|04) 'Keep track of first and last Detail record numbers
  3. |2040 GOSUB 3100:BLINKNORMAL%=|28:BLINKINSERT%=|29:BLINK2%=|30 'For CGA or EGA adapter, BLINKNORMAL%=6, BLINKINSERT%=4 and BLINK2%=7. For Monochrome adapter, BLINKNORMAL%=13, BLINKINSERT%=9 and BLINK2%=14.
  4. 2050 CLS:LOCATE 1,16,0:COLOR COLA%(2),COLA%(1)
  5. |2060 PRINT "PDS*BASE Data Base Import File Program |01";:COLOR COLA%(2),0
  6. 2070 PRINT:PRINT:COLOR COLA%(2),0:PRINT "This program will import comma delimited records from an ASCII file to"
  7. 2080 PRINT "the ";ZS$(YT%(1,1),1);" data base file.  The ASCII file records can be from"
  8. 2090 PRINT "some other program or data file."
  9. 2100 PRINT:POSX=CSRLIN
  10. 2110 LOCATE POSX+1,10,1:COLOR COLA%(2),0:PRINT "Enter Import File Name ";:COLOR 7,0:INPUT F$
  11. 2120 IF F$="" THEN BEEP:LOCATE 24,15,0:COLOR 15,0:PRINT "No file name entered - Strike any key to continue";:COLOR 7,0:A$=INPUT$(1):LOCATE 24,1:PRINT SPC(79):LOCATE POSX+2,1:PRINT SPC(79):GOTO 2070
  12. 2130 ON ERROR GOTO 2140:OPEN F$ FOR INPUT AS #ZQ+1:GOTO 2160
  13. 2140 RESUME 2150
  14. 2150 BEEP:LOCATE 24,18,0:COLOR 15,0:PRINT "File not found - Strike any key to continue";:COLOR 7,0:A$=INPUT$(1):LOCATE 24,1:PRINT SPC(79):LOCATE POSX+2,1:PRINT SPC(79):GOTO 2070
  15. 2160 'File was found and opened - do not remove this REM line
  16. *23 2170 ZA=YT%(1,1):IF ZS%(ZA,1)=1 GOTO 2200
  17. *23 2180 ZS=YT%(1,1):Y11=0:FOR ZI=1 TO ZQ:IF ZS$(ZA,2)=ZS$(ZI,1) THEN Y11=ZI:ZM=ZI:ZI=ZQ:ZR$=STRING$(ZSIZE%(ZM,1),32)
  18. *23 2190 NEXT:IF Y11=0 THEN BEEP:PRINT "NO MASTER SET FOUND FOR '";ZS$(ZA,1);". - Strike any key to end program":A$=INPUT$(1):GOTO 400
  19. 2220 'Add New Records - do not remove this REM line
  20. 2230 WHILE NOT EOF(ZQ+1)
  21. *23 2240    IF ZS%(YT%(1,1),1)=2 THEN INPUT #ZQ+1, YC$:LSET ZR$=YC$ 'if a Detail file, we MUST know the search value for the associated Master File
  22. |2250    FOR J=1 TO |35:INPUT #ZQ+1, ZI$(YT%(J,2),YT%(J,1)):NEXT
  23. *23 2260    IF ZS%(YT%(1,1),1)=2 THEN ZA=ZM:GOSUB 500:GOSUB 600:YM=ZR:ZA=ZS:ZMASTER$=ZN$(ZM,1,1)+"="+YC$:ZA=YT%(1,1):IF ZV>0 THEN PRINT "This record skipped - Strike any key to continue":YQ$=INPUT$(1)
  24. *23 2280    IF ZS%(YT%(1,1),1)=1 THEN ZR$=ZI$(ZS%(ZA,10),ZA):GOSUB 800:ZA=YT%(1,1)
  25. *28 2280    ZR$=ZI$(ZS%(ZA,10),ZA):GOSUB 800:ZA=YT%(1,1)
  26. 2290 WEND
  27. 2300 CLOSE ZQ+1
  28. 2310 LOCATE 24,1,0:PRINT SPC(79):LOCATE 24,16:PRINT "All records loaded - Strike any key to continue";:A$=INPUT$(1):GOTO 400
  29. 3100 'SETUP SUBROUTINE
  30. |3110 FOR ZI=1 TO |35:FOR ZJ=1 TO 8:READ YT%(ZI,ZJ):NEXT:NEXT 'ZI
  31. 3120 ' YT%(X,Y) X=Field on report, Y=1 is file number, 2=field in that file, 4-8 not used
  32. *44
  33. |3300 FOR ZI=2 TO |35:IF YT%(ZI,1) <> YT%(1,1) THEN BEEP:PRINT "This program trying to Import to more than 1 data base file - Must Cancel":YQ$=INPUT$(1):GOTO 400
  34. 3310 NEXT
  35. 3320 RETURN
  36. *31 Copyright 1987 by PRO DEV Software
  37.